//
//  HelperFunctions.cpp
//  NewGL2
//
//  Created by Scott Nelson on 5/26/11.
//  Copyright 2011 NA. All rights reserved.
//

#include "HelperFunctions.h"

//Function to draw pyramid
void drawPyramid()
{
    glBegin(GL_TRIANGLES);
    
    //Front side
    glColor3f(1.0f,0.0f,0.0f);			// Red
    glVertex3f( 0.0f, 1.0f, 0.0f);		// Top Of Triangle (Front)
    glColor3f(0.0f,1.0f,0.0f);			// Green
    glVertex3f(-1.0f,-1.0f, 1.0f);		// Left Of Triangle (Front)
    glColor3f(0.0f,0.0f,1.0f);			// Blue
    glVertex3f( 1.0f,-1.0f, 1.0f);		// Right Of Triangle (Front)
    
    //Right side
    glColor3f(1.0f,0.0f,0.0f);			// Red
    glVertex3f( 0.0f, 1.0f, 0.0f);		// Top Of Triangle (Right)
    glColor3f(0.0f,0.0f,1.0f);			// Blue
    glVertex3f( 1.0f,-1.0f, 1.0f);		// Left Of Triangle (Right)
    glColor3f(0.0f,1.0f,0.0f);			// Green
    glVertex3f( 1.0f,-1.0f, -1.0f);		// Right Of Triangle (Right)
    
    //Back side
    glColor3f(1.0f,0.0f,0.0f);			// Red
    glVertex3f( 0.0f, 1.0f, 0.0f);		// Top Of Triangle (Back)
    glColor3f(0.0f,1.0f,0.0f);			// Green
    glVertex3f( 1.0f,-1.0f, -1.0f);		// Left Of Triangle (Back)
    glColor3f(0.0f,0.0f,1.0f);			// Blue
    glVertex3f(-1.0f,-1.0f, -1.0f);		// Right Of Triangle (Back)
    
    //Left side
    glColor3f(1.0f,0.0f,0.0f);			// Red
    glVertex3f( 0.0f, 1.0f, 0.0f);		// Top Of Triangle (Left)
    glColor3f(0.0f,0.0f,1.0f);			// Blue
    glVertex3f(-1.0f,-1.0f,-1.0f);		// Left Of Triangle (Left)
    glColor3f(0.0f,1.0f,0.0f);			// Green
    glVertex3f(-1.0f,-1.0f, 1.0f);		// Right Of Triangle (Left)
    glEnd();
    
    //Bottom side
    glBegin(GL_QUADS);
    
    glColor3f(0.0f,1.0f,0.0f);			// Set The Color To Green
    glVertex3f(-1.0f, -1.0f, 1.0f);
    glColor3f(0.0f,0.0f,1.0f);          // Set Color to Blue
    glVertex3f(-1.0f, -1.0f, -1.0f);
    glColor3f(1.0f,0.0f,0.0f);          // Set Color to Red
    glVertex3f(1.0f, -1.0f, -1.0f);
    glColor3f(1.0f,0.0f,1.0f);          // Set Color to Purple
    glVertex3f(1.0f, -1.0f, 1.0f);
    glEnd();
}

//Function to draw a cube
void drawCube()
{
    glBegin(GL_QUADS);
    
    //Top side
    glColor3f(0.0f,1.0f,0.0f);			// Set The Color To Green
    glVertex3f( 1.0f, 1.0f,-1.0f);		// Top Right Of The Quad (Top)
    glColor3f(0.0f,0.0f,1.0f);          // Set Color to Blue
    glVertex3f(-1.0f, 1.0f,-1.0f);		// Top Left Of The Quad (Top)
    glColor3f(1.0f,0.0f,0.0f);          // Set Color to Red
    glVertex3f(-1.0f, 1.0f, 1.0f);		// Bottom Left Of The Quad (Top)
    glColor3f(1.0f,1.0f,0.0f);          // Set Color to Teal
    glVertex3f( 1.0f, 1.0f, 1.0f);		// Bottom Right Of The Quad (Top)
    
    //Bottom side
    glColor3f(1.0f,0.0f,1.0f);			// Set The Color To Orange
    glVertex3f( 1.0f,-1.0f, 1.0f);		// Top Right Of The Quad (Bottom)
    glColor3f(0.0f,0.0f,1.0f);          // Set Color to Blue
    glVertex3f(-1.0f,-1.0f, 1.0f);		// Top Left Of The Quad (Bottom)
    glColor3f(1.0f,1.0f,0.0f);          // Set Color to Teal
    glVertex3f(-1.0f,-1.0f,-1.0f);		// Bottom Left Of The Quad (Bottom)
    glColor3f(0.0f,1.0f,0.0f);          // Set Color to Red
    glVertex3f( 1.0f,-1.0f,-1.0f);		// Bottom Right Of The Quad (Bottom)
    
    //Front side
    glColor3f(1.0f,0.0f,0.0f);			// Set The Color To Red
    glVertex3f( 1.0f, 1.0f, 1.0f);		// Top Right Of The Quad (Front)
    glColor3f(0.0f,1.0f,0.0f);          // Set Color to Green
    glVertex3f(-1.0f, 1.0f, 1.0f);		// Top Left Of The Quad (Front)
    glColor3f(0.0f,0.0f,1.0f);          // Set Color to Blue
    glVertex3f(-1.0f,-1.0f, 1.0f);		// Bottom Left Of The Quad (Front)
    glColor3f(0.0f,1.0f,1.0f);          // Set Color to Teal
    glVertex3f( 1.0f,-1.0f, 1.0f);		// Bottom Right Of The Quad (Front)
    
    //Back side
    glColor3f(1.0f,1.0f,0.0f);          // Set The Color To Yellow
    glVertex3f( 1.0f,-1.0f,-1.0f);		// Bottom Left Of The Quad (Back)
    glColor3f(0.0f,1.0f,0.0f);          // Set Color to Green
    glVertex3f(-1.0f,-1.0f,-1.0f);		// Bottom Right Of The Quad (Back)
    glColor3f(0.0f,0.0f,1.0f);          // Set Color to Blue
    glVertex3f(-1.0f, 1.0f,-1.0f);		// Top Right Of The Quad (Back)
    glColor3f(0.0f,1.0f,1.0f);          // Set Color to Teal
    glVertex3f( 1.0f, 1.0f,-1.0f);		// Top Left Of The Quad (Back)
    
    //Left side
    glColor3f(0.0f,0.0f,1.0f);          // Set The Color To Blue
    glVertex3f(-1.0f, 1.0f, 1.0f);		// Top Right Of The Quad (Left)
    glColor3f(1.0f,0.0f,1.0f);          // Set Color to Purple
    glVertex3f(-1.0f, 1.0f,-1.0f);		// Top Left Of The Quad (Left)
    glColor3f(1.0f,0.0f,1.0f);			// Set The Color To Orange
    glVertex3f(-1.0f,-1.0f,-1.0f);		// Bottom Left Of The Quad (Left)
    glColor3f(1.0f,1.0f,0.0f);          // Set The Color To Yellow
    glVertex3f(-1.0f,-1.0f, 1.0f);		// Bottom Right Of The Quad (Left)
    
    //Right side
    glColor3f(1.0f,0.0f,1.0f);			// Set The Color To Violet
    glVertex3f( 1.0f, 1.0f,-1.0f);		// Top Right Of The Quad (Right)
    glColor3f(1.0f,1.0f,0.0f);			// Set The Color To Yellow
    glVertex3f( 1.0f, 1.0f, 1.0f);		// Top Left Of The Quad (Right)
    glColor3f(0.0f,1.0f,1.0f);          // Set Color to Teal
    glVertex3f( 1.0f,-1.0f, 1.0f);		// Bottom Left Of The Quad (Right)
    glColor3f(1.0f,1.0f,1.0f);          // Set Color to White
    glVertex3f( 1.0f,-1.0f,-1.0f);		// Bottom Right Of The Quad (Right)
    glEnd();
}

